# Maintainer: Noel Kuntze <noel.kuntze@contauro.com>
pkgname=grommunio-index
pkgdesc="Generator for grommunio-web search indexes"
pkgver=1.0
pkgrel=0
arch="all !riscv64"
url="https://grommunio.com"
license="AGPL-3.0-only"
options="!check" # No test suite
makedepends="cmake ninja libexmdbpp-dev libhx-dev sqlite-dev>=3.27 mariadb-connector-c-dev"

source="$pkgname-$pkgver.tar.gz::https://github.com/grommunio/grommunio-index/archive/refs/tags/$pkgver.tar.gz
	0001-makefile.patch

	$pkgname.cron
	"

build() {
	cmake -B build -G Ninja \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_BUILD_TYPE=MinSizeRel \
		-DCMAKE_SKIP_INSTALL_RPATH=ON

	cmake --build build
}

package() {
	DESTDIR="$pkgdir" cmake --install build

	# license
	install -Dm644 LICENSE.txt "$pkgdir/usr/share/licenses/$pkgname/LICENSE"

	# install cronjob
	install -Dm755 "$srcdir"/$pkgname.cron "$pkgdir"/etc/periodic/15min/$pkgname

}

sha512sums="
8e11ff019c124ce8cf54116bff288411942f9da0661a7e88d66cb9d7354b6eb4bf7a1583f353920318b9c75dfccf5b3e88a7f3141da112ba4d676e57533d93e4  grommunio-index-1.0.tar.gz
b20690bc3e275d083e69a62e883d3b3da02d8a9bbbbd2df736e40915005ef1029056e7d9bdc1f9bc8047439f48b0dcf4868abeb64ec191a04c41a1d818c02f81  0001-makefile.patch
972dea2faa155dd9f62ce1724190c0b3cd2c506bd0d250512e10a6ca54a7b3b0afe25d2ed5739df30d2acbe8c6ee1baf539b23600bd7f2b3f11466bc8c7f3c7e  grommunio-index.cron
"
